package com.tul.exercise.base.thread.shareresources;

/**
 *
 */
public abstract class IntGenerator {
    // 保证操作的原子性，设置为volatile
    private volatile boolean canceled = false;

    // 抽象函数
    public abstract int next();

    public void cancel() {
        canceled = true;
    }

    public boolean isCanceled() {
        return canceled;
    }
}
